Skip to main content

Refund Transaction

Path

  • URL: /cb-core/api/v1/transaction/refund
  • Method: POST
  • Description: This API allows to create request to refund a transaction

Request

Request Table

ParamsData Type + LengthRequiredDescription
request_idstring(50)YesUnique request ID, suggested format: MerchantCode+YYYYMMDDHHMMSS+UniqueId
request_timestring(19)YesRequest time in format: YYYY-MM-DD HH:MM:SS
merchant_codestring(20)YesMerchant code provided by Baokim before integration
sub_merchant_codestring(50)YesIf the Seller is under your sub-merchant, fill your sub merchant code provided by Baokim.
If Seller is under you, fill your Merchant_code provided by Baokim as above
seller_idstring(50)YesSeller ID matching the Onboarding Sellers API
refunded_transaction_idstring(50)YesFill Baokim's transaction ID which merchant wants to make refund
refund_reference_idstring(50)YesThe reference code of the refund managed in your system. This code is unique.
refund_typeint(1)Yes1: Full refund, 2: Partial refund. Default = 1
amountdecimal(12,2)YesAmount of the order
fee_payerint(1)Yes1: Merchant, 2: User. Default = 1
reasonstring(255)YesReason for refund

Request Example

{
"request_id": "MERCHANT12345678901234510281",
"request_time": "2024-11-15 14:36:00",
"merchant_code": "PHUONGTT",
"sub_merchant_code": "SUBPHUONGTT",
"seller_id": "SELLER12345678901234510281",
"refunded_transaction_id": "1234567892",
"refund_reference_id": "TT1234567890",
"amount": "1000000.00",
"refund_type": 1,
"fee_payer": 1,
"reason": "Customer requested a refund"
}

Response

Response Table

ParamsData Type + LengthRequiredDescription
response_codeint(4)YesError code from Baokim as per Error Codes Table
response_messagestring(100)YesDescription of the error code from Baokim as per Error Codes Table
dataobjectYesData of the response
data.merchant_codestring(20)YesMerchant code provided by Baokim before integration
data.sub_merchant_codestring(20)YesSub merchant code provided by Baokim before integration
data.refund_reference_idstring(50)YesThe reference code of refund managed in your system. This code is unique
data.refund_transaction_idstring(50)YesThe refund transaction id from Baokim
data.refunded_transaction_idstring(50)YesBaokim's transaction ID which merchant wants to make refund
data.refund_statusint(1)YesThe refund status. 1. Success, 2. Failed, 3. Pending
data.refund_typeint(1)Yes1: Full refund, 2: Partial refund. Default = 1
data.request_amountdecimal(12,2)YesRequest amount
data.refund_feedecimal(12,2)YesFee of refund
data.fee_payerint(1)Yes1: Merchant, 2: User. Default = 1
data.refund_amountdecimal(12,2)YesRefund amount
data.reasonstring(255)YesReason for refund

Response Example

{
"response_code": 200,
"response_message": "Success",
"data": {
"merchant_code": "PHUONGTT",
"sub_merchant_code": "SUBPHUONGTT",
"seller_id": "SELLER12345678901234510281",
"refund_reference_id" : "TT1234567890",
"refund_transaction_id": "1234567893",
"refunded_transaction_id": "1234567892",
"refund_status": 1,
"refund_type": 1,
"refund_amount": "1000000.00",
"request_amount": "1000000.00",
"fee_payer": 1,
"refund_fee": "0.00",
"reason": "Customer requested a refund"
}
}

Error Code

Response CodeResponse Message
200Success
99Pending
11Failed
101System Error
110Merchant Code Invalid
120Invalid Signature
422Validation Error